<?php
namespace Arathi;

require_once(__DIR__ . "/../vendor/simple-html-dom/simple-html-dom/simple_html_dom.php");

class HtmlDomParser
{
    private $dom;
    
    public function __construct()
    {
        $this->dom = new \simple_html_dom();
    }

    public function load($html)
    {
        $this->dom->load($html);
    }

    public function loadFromUrl($url)
    {
        $this->dom->load_file($url);
    }

    public function find($selector, $idx=null, $lowercase=false)
    {
        return $this->dom->find($selector, $idx, $lowercase);
    }

    public function clear()
    {
        $this->dom->clear();
    }

    function save($filepath='')
    {
        return $this->dom->save();
    }
}
